{{--/**
 * Created by PhpStrom
 * User: 郭碧云
 * Date: 2021/3/2 8:33
 * Desc:
 */--}}
@extends("layout.admin")

@section("title")
    系统设置
@endsection

@section("content")
    <style>
        .input-width {
            width: 32%;
        }
    </style>
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li><a href="{{route('admin.set.index')}}">基础设置</a></li>
            <li class="layui-this"><a href="{{route('admin.set.index.attach.1')}}">顶部导航</a></li>
            <li><a href="{{route('admin.set.index.attach.2')}}">用户设置</a></li>
            <li><a href="{{route('admin.set.index.attach.3')}}">微信设置(待完成)</a></li>
            <li><a href="{{route('admin.set.index.attach.4')}}">企业微信设置(待完成)</a></li>
            <li><a href="{{route('admin.set.index.attach.5')}}">钉钉设置(待完成)</a></li>
            <li>云存储(暂缓)</li>
        </ul>
        <div class="layui-tab-content" style="height: auto;">
            {{--基础设置--}}
            <div class="layui-tab-item layui-show">
                <form class="layui-form" action="{{route('admin.set.create')}}" method="post">
                    {{csrf_field()}}
                    <table lay-filter="table-hide"
                           lay-data="{defaultToolbar:['filter'], limit:30 }">
                        <thead>
                        <tr>
                            <th lay-data="{field:'name'}">名称</th>
                            <th lay-data="{field:'status'}">状态</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>首页</td>
                            <td>
                                <a class="layui-btn-xs">
                                    <input class="uris" type="checkbox" data-uri="admin.index" name="open" lay-skin="switch"
                                           lay-filter="switchLocked" lay-text="ON|OFF">
                                </a>
{{--                                <input value="admin.index" />--}}
                            </td>
                        </tr><tr>
                            <td>首页</td>
                            <td>
                                <a class="layui-btn-xs">
                                    <input class="uris" type="checkbox" data-uri="admin.index" name="open" lay-skin="switch"
                                           lay-filter="switchLocked" lay-text="ON|OFF">
                                </a>
{{--                                <input value="admin.index" />--}}
                            </td>
                        </tr><tr>
                            <td>首页</td>
                            <td>
                                <a class="layui-btn-xs">
                                    <input class="uris" type="checkbox" data-uri="admin.index" name="open" lay-skin="switch"
                                           lay-filter="switchLocked" lay-text="ON|OFF">
                                </a>
{{--                                <input value="admin.index" />--}}
                            </td>
                        </tr><tr>
                            <td>首页</td>
                            <td>
                                <a class="layui-btn-xs">
                                    <input class="uris" type="checkbox" data-uri="admin.index" name="open" lay-skin="switch"
                                           lay-filter="switchLocked" lay-text="ON|OFF">
                                </a>
{{--                                <input value="admin.index" />--}}
                            </td>
                        </tr><tr>
                            <td>首页</td>
                            <td>
                                <a class="layui-btn-xs">
                                    <input class="uris" type="checkbox" data-uri="admin.index" name="open" lay-skin="switch"
                                           lay-filter="switchLocked" lay-text="ON|OFF">
                                </a>
{{--                                <input value="admin.index" />--}}
                            </td>
                        </tr><tr>
                            <td>首页</td>
                            <td>
                                <a class="layui-btn-xs">
                                    <input class="uris" type="checkbox" data-uri="admin.index" name="open" lay-skin="switch"
                                           lay-filter="switchLocked" lay-text="ON|OFF">
                                </a>
{{--                                <input value="admin.index" />--}}
                            </td>
                        </tr><tr>
                            <td>首页</td>
                            <td>
                                <a class="layui-btn-xs">
                                    <input class="uris" type="checkbox" data-uri="admin.index" name="open" lay-skin="switch"
                                           lay-filter="switchLocked" lay-text="ON|OFF">
                                </a>
{{--                                <input value="admin.index" />--}}
                            </td>
                        </tr>
                        </tbody>
                    </table>


                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="button" id="sub" data-name="navgication" class="layui-btn" lay-submit="">确定
                            </button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection

@section("script")
    <script>
        layui.use(['element', 'form', 'upload', 'table'], function () {
            var $ = layui.jquery
                , element = layui.element //Tab的切换功能，切换事件监听等，需要依赖element模块
                , form = layui.form
                , table = layui.table;
            table.init("table-hide");
            //监听用户状态开关
            form.on('switch(switchLocked)', function (data) {
                let status = this.checked ? 0 : 1;
                const id = data.elem.getAttribute('data-id');

            });
            //todo 顶部导航待完善
            $("#sub").click(function (data) {
                let name = data.currentTarget.dataset.name;
                console.log($(".uris").data("uri"))
                // let value = {"name": $("#name").val(), "logo": $("#logoicon").val(), "webicon": $("#wicon").val()};
                {{--admin.set("{{route('admin.set.create')}}", "{{csrf_token()}}", name, value);--}}
            });
        });
    </script>
@endsection

